using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Xivo
{
  public partial class OptionsDialog : Form
  {
    public event EventHandler OkClicked;
    public event EventHandler CancelClicked;

    public string RecordSource
    {
      get { return recordOptions.RecordSource; }
      set { recordOptions.RecordSource = value; }
    }

    public bool XMDirect
    {
      set { ckXMDirect.Checked = value; }
      get { return ckXMDirect.Checked; }
    }

    public string RecordPath
    {
      set { tbRecordFolder.Text = value; }
      get { return tbRecordFolder.Text; }
    }

    public string ComPort
    {
      get { return tbComPort.Text; }
      set { tbComPort.Text = value; }
    }

    public OptionsDialog()
    {
      InitializeComponent();
    }

    private void bBrowse_Click(object sender, EventArgs e)
    {
      folderBrowserDialog1.SelectedPath = tbRecordFolder.Text;
      folderBrowserDialog1.ShowDialog(this);
      tbRecordFolder.Text = folderBrowserDialog1.SelectedPath;
    }

    private void bDefaults_Click(object sender, EventArgs e)
    {
      if(MessageBox.Show("Reset Defaults?","Reset", MessageBoxButtons.YesNo) == DialogResult.Yes)
      {
        ComPort="COM1";
        RecordPath="C:\\mp3\\temp";
        XMDirect = true;
      }
    }

    private void bOk_Click(object sender, EventArgs e)
    {
      if (OkClicked != null)
        OkClicked(this, new EventArgs());
      Hide();
    }

    private void Options_Load(object sender, EventArgs e)
    {
    }

    private void bCancel_Click(object sender, EventArgs e)
    {
      if (CancelClicked != null)
        CancelClicked(this, new EventArgs());
      Hide();
    }

  }
}